import instacne from "../request";
import type { Ref } from "vue";

/**
 * /barnd/list根据品牌名称分页获取品牌列表
 */
interface IBrandListParams {
  keyword?: string | Ref<string>;
  pageNum?: number | Ref<number>;
  pageSize?: number | Ref<number>;
}

interface IBrandListItem {
  bigPic: string;
  brandStory: string;
  factoryStatus: number;
  firstLetter: string;
  id: number;
  logo: string;
  name: string;
  productCommentCount: number;
  productCount: number;
  showStatus: number;
  sort: number;
  status: number;
}

interface IBrandListRes {
  list: IBrandListItem[];
  pageNum: number;
  pageSize: number;
  total: number;
  totalPage: number;
}

// 根据品牌名称分页获取品牌列表
const getBrandList = (data?: IBrandListParams): Promise<IBrandListRes> => {
  return instacne.get("/brand/list", {
    params: data,
  });
};

// 批量更新厂家制造商状态
const updataBrandFactoryStatus = (data?: IBrandListItem) => {
  return instacne.post("/brand/update/factoryStatus", { params: data });
};
// 批量更新显示状态;
const updataBrandShowStatus = (data: IBrandListItem) => {
  return instacne.post("/brand/update/showStatus", { params: data });
};
export { getBrandList, updataBrandFactoryStatus, updataBrandShowStatus };
export type { IBrandListItem };
